package hot100;

public class Solution852 {
    public int peakIndexInMountainArray(int[] arr) {
        int i = 0;
        int j = arr.length - 1;
        while (i < j) {
            int mid = (i + j) >> 1;
            if (mid + 1 < arr.length && arr[mid] > arr[mid + 1]) j = mid;
            else i = mid + 1;
        }
        return i;
    }
}
